<template>
  <!-- ...保留原有template内容不变... -->
</template>

<script>
import MemberCard from '@/components/member-card.vue'
import Timer from '@/components/timer.vue'
import Invite from '@/components/invite.vue'
import { mapState, mapMutations } from 'vuex'

export default {
  components: {
    MemberCard,
    Timer,
    Invite
  },
  computed: {
    ...mapState('game', [
      'roundTime',
      'isHost',
      'isPrepared',
      'members'
    ])
  },
  methods: {
    ...mapMutations('game', [
      'SET_ROUND_TIME',
      'SET_PREPARED'
    ]),
    handleInviteSuccess() {
      // 处理邀请成功
    },
    handleTimeChange(time) {
      this.SET_ROUND_TIME(time)
    },
    handlePrepare() {
      this.SET_PREPARED(true)
      // 更新当前玩家状态
      const currentPlayer = this.members.find(member => member.id === 1)
      if (currentPlayer) {
        currentPlayer.status = '已准备'
      }
    },
    handleStart() {
      // 开始游戏逻辑
      console.log('游戏开始')
    },
    navigateToAchievement() {
      uni.navigateTo({
        url: '/pages/achievement/index'
      })
    },
    navigateToStats() {
      uni.navigateTo({
        url: '/pages/stats/index'
      })
    },
    navigateToRules() {
      uni.navigateTo({
        url: '/pages/rules/index'
      })
    }
  }
}
</script>

<style scoped>
/* ...保留原有样式不变... */
</style>
